function datac_paths()
%
% set paths as necessary for datac to run.
% also remove paths that are normally unnecessary (plotgen, figures).
%
global PATHS

bp='';
if(strmatch(computer, 'PCWIN', 'exact'))
    bp = pwd; % 'c:\mat_datac';
end;
if(~isempty(strmatch(computer, {'MAC', 'MACI'}, 'exact')))
    [err bp0]= system('echo $HOME');
    bp = strcat(bp0, '/desktop/mat_datac');
end;
cd (bp);
addpath(bp, '-BEGIN');
removepath(bp, 'MiscUtilities');

PATHS.BP = bp; % save the base path

needed = {'/pbm_tools', '/Fitting', '/Analysis', '/Plotgen', '/Figures', '/Plugins'};
fmake = {0, 0, 0, 1, 0, 1}; % force make flag
if(length(needed) ~= length(fmake))
    fmake = ones(length(needed));
end;
for i = 1:length(needed)
    needed{i} = slash4OS([bp needed{i}]);
    if(~exist(char(needed{i}), 'dir')) % if directory doesn't exist, then
        if(fmake{i} == 1)                  % check to see if we need to make it.
            mkdir(char(needed{i}));
            addpath(char(needed{i})); % now it exists - so add it to path
        end;
    else
        addpath(char(needed{i})); % exists - so add it to path
        fprintf(1, 'added %s\n', needed{i});
    end;
end;
p = path;
if(findstr(p, 'mat_datac:') == 0) % only add if it is not already in the list
    addpath(bp); % do this last so it appears first in the list
end;
return;



function removepath(base, pbye)
% from the base path, remove pbye, if it exists.....
if(findstr(lower([base slash4OS('\\') pbye]), lower(path)))
    rmpath([base slash4OS('\\') pbye]);
end;
return;

